#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>

int main()
{
	int imu_data[3] = {0x79805, 0xf461f, 0x900f8ff}; 
	FILE *fp_imu = fopen("test", "w+");
	char imu_buf[128] = {0};
	int i = 0;

	for (i = 0; i < 1; i++) 
	{
		sprintf(imu_buf, "0x%08x 0x%08x 0x%08x\n", imu_data[0], imu_data[1], imu_data[2]);
		fwrite(imu_buf, 1, sizeof(imu_data), fp_imu);
		fwrite(imu_buf, 1, sizeof(imu_data), fp_imu);
		fwrite(imu_buf, 1, sizeof(imu_data), fp_imu);
		fwrite(imu_buf, sizeof(imu_data), 1, fp_imu);
		sleep(1);
	}

	printf("%d %d\n", sizeof(int), sizeof(long));

	i = 0;
	i = ftell(fp_imu);
	printf("file len is %d\n", i);

	return 0;
}
